#include "template.hpp"

int fun_vector()
{
	// Initialize a vector with values
	vi arr = {5, 2, 1, -1, 4};

	// Add element to the end
	arr.pb(18);
	each(x, arr) show(x); // Print each element

	// Remove last element
	arr.pop_back();
	each(x, arr) show(x);

	// Modify element at index 1
	arr[1] = 100;
	each(x, arr) show(x);

	// Iterate using iterator
	for (vi::iterator it = arr.begin(); it != arr.end(); ++it)
	{
		cout << *it << " "; // Dereference iterator to access value
	}
	cout << endl;

	// Insert 15 at position 1
	auto it = arr.begin();
	arr.insert(it + 1, 15);

	// Erase element at position 2
	arr.erase(it + 2);

	return 0;
}

// int main() {
//	fun_vector();
//	return 0;
// }
